<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />

		<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
		Remove this if you use the .htaccess -->
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

		<title>web04-2</title>
		<meta name="description" content="" />
		<meta name="author" content="choongang" />

		<meta name="viewport" content="width=device-width; initial-scale=1.0" />

		<!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
		<link rel="shortcut icon" href="/favicon.ico" />
		<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
	</head>

	<body>
		<table>
			<tr>
				<td><button id="left"> 왼쪽그림 </button></td>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<td><button id="right"> 오른쪽그림 </button></td>
			</tr>
		<tr>
			<td colspan="2"><img id="gallery"/></td>
		</tr>
		<tr>
			<td colspan="2"><div id="title">사진이 바꼇습니다.</div></td>
		</tr>
		</table>
		<script>
		
			var title = document.getElementById("title");
			
			images=["1.jpg","2.jpg","3.jpg","4.jpg","5.jpg"];
			str=["하나","둘","셋","넷","다섯"];
			
			var i =0;
			gallery.src=images[i];
			
			left.onclick=function(){
				i--;
				if(i<0) i=images.length-1;
				gallery.src=images[i];
				title.innerHTML=str[i];
			}
			
			right.onclick=function(){
				i++
				if(i>4) i=0;
				gallery.src=images[i];
				title.innerHTML=str[i];
			}
			//setInterval 이건 (펑션,시간 (5초))마다 수행한다 펑션을!!
			setInterval(left.onclick,5000);
					
		</script>
		
	</body>
	
</html>
